package com.google.rui.demos.tabhost;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.google.rui.demos.R;

/**
 * Tabhost 实例
 * @author  china1988s   Email: china1988s@126.com
 * @email   china1988s@126.com
 */
public class TabhostDemosActivity extends Activity {
    /** Called when the activity is first created. */
    ListView mListView;
	String[] mDemosArrary; 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabhost_demos);
        mListView=(ListView)findViewById(R.id.liv_demos);
        mDemosArrary=getResources().getStringArray(R.array.demosArray);
        ArrayAdapter<String> arraryAdapter= new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, mDemosArrary);
        mListView.setAdapter(arraryAdapter);
        mListView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				switch(position){
				case 0:
					Intent intent=new Intent(TabhostDemosActivity.this,TabhostFromXml.class);
					startActivity(intent);
					break;
				case 1:
				    intent=new Intent(TabhostDemosActivity.this,TabhostText.class);
					startActivity(intent);
					break;
				case 2:
				    intent=new Intent(TabhostDemosActivity.this,TabhostMyText.class);
					startActivity(intent);
					break;
				case 3:
					intent=new Intent(TabhostDemosActivity.this,TabhostMyText2.class);
					startActivity(intent);
						break;
				case 4:
					intent=new Intent(TabhostDemosActivity.this,TabhostMyText3.class);
					startActivity(intent);
						break;
				default:
						break;
				
				}
				
			}
		});
    }
    /**
     * 创建自定义对话框
     * <p><strong>通过系统对话框添加view</storng></P>
     */
    public void createDialog(){
    	
    	Dialog dialog=new Dialog(this, android.R.style.Theme_NoTitleBar);
    	dialog.setContentView(R.layout.tabhost_info);
    	dialog.show();
    	
    }
  
    
    
}